package cvi.com.reader.network;


import com.alibaba.fastjson.JSONObject;

import java.util.Map;

import cvi.com.reader.base.BasicResponse;
import cvi.com.reader.bean.LoginBean;
import cvi.com.reader.uploadrecord.ProgressRequestBody;
import io.reactivex.Observable;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.Field;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Part;
import retrofit2.http.Path;
import retrofit2.http.Query;
import retrofit2.http.Url;

/**
 * Created by window on 2018/3/7.
 */

public interface NetWorkApi {
    @POST("register")
    @FormUrlEncoded
    Observable<JSONObject> register(@FieldMap Map<String, Object> map);

    //注册界面-密码问题列表
    @GET("secret_guard/questions")
    Observable<JSONObject> getRegisterQuestion();

    //党支部列表
    @GET("poc_list")
    Observable<JSONObject> getPartBranch();

    @POST("login")
    @FormUrlEncoded
    Observable<JSONObject> login(@FieldMap Map<String, Object> map);

    //登出
    @GET("logout")
    Observable<JSONObject> loginOut();

    @GET("categories/all")
    Observable<JSONObject> getCategoriesData();

    //获取宫格ID
    @GET("categories/{pid}")
    Observable<JSONObject> getHomePageData(@Path("pid") int pid);

    //热门作品
    @GET("materials/list/{category_id}")
    Observable<JSONObject> getHomePageHotData(@Path("category_id") int category_id);

    //排行榜
    @GET("works/list/{material_id}")
    Observable<JSONObject> getRankData(@Path("material_id") int material_id);

    //随机朗读
    @GET("materials/search")
    Observable<JSONObject> getRandomData();

    //搜索
    @GET("materials/search/{search}")
    Observable<JSONObject> getSearchData(@Path("search") String search);

    //宫格详情
    @GET("materials/list/{category_id}")
    Observable<JSONObject> getGridDailsData(@Path("category_id") int category_id);

    //绘本
    @GET("materials/list/{category_id}")
    Observable<JSONObject> getPictureBookData(@Path("category_id") int category_id);

    //收藏
    @POST("user/collections/{material_id}")
    Observable<JSONObject> setCollect(@Path("material_id") int material_id);

    //取消收藏
    @DELETE("user/collections/{material_id}")
    Observable<JSONObject> removeCollect(@Path("material_id") int material_id);

    //文学巨匠
    @GET("categories/{pid}")
    Observable<JSONObject> getLiteraryMasterData(@Path("pid") int pid);

    //课本
    @GET("categories/{pid}")
    Observable<JSONObject> getLTextBookData(@Path("pid") int pid);

    //课本
    @GET("materials/list/{category_id}")
    Observable<JSONObject> getLTextBookListData(@Path("category_id") int category_id);

    //个人中心-我的发布和草稿箱
    @GET("user/works/{released}")
    Observable<JSONObject> getPublicData(@Path("released") int released);

    //个人中心-我的收藏
    @GET("user/collections")
    Observable<JSONObject> getCollectData();

    //个人中心-删除我的发布
    @DELETE("user/works/{record_id}")
    Observable<JSONObject> deletePubilcData(@Path("record_id") int record_id);

    //个人中心-删除草稿
    @DELETE("user/draft/{record_id}")
    Observable<JSONObject> deleteDraftData(@Path("record_id") int record_id);

    //个人中心-删除收藏
    @DELETE("user/collections/{material_id}")
    Observable<JSONObject> deleteCollcetData(@Path("material_id") int material_id);

    //个人中心-删除全部收藏
    @DELETE("user/collections")
    Observable<JSONObject> deleteAllCollcetData();

    //个人中心-删除全部发布
    @DELETE("user/works")
    Observable<JSONObject> deleteAllPubilcData();

    //个人中心-删除全部草稿
    @DELETE("user/draft")
    Observable<JSONObject> deleteAllDraftData();

    //背景音乐分类
    @GET("bgm/categories")
    Observable<JSONObject> getBGMCategorData();

    //背景音乐分类
    @GET("bgm/list/{bgm_category_id}")
    Observable<JSONObject> getBGMListData(@Path("bgm_category_id") int bgm_category_id);

    //点赞
    @PUT("works/like/{record_id}")
    Observable<JSONObject> setPraise(@Path("record_id") int record_id);

    //取消点赞
    @DELETE("works/like/{record_id}")
    Observable<JSONObject> canclePraise(@Path("record_id") int record_id);

    //举报
    @POST("tip_off/{record_id}/{reason_id}")
    Observable<JSONObject> setReport(@Path("record_id") int record_id, @Path("reason_id") int reason_id);

    @GET("tip_off/reasons")
    Observable<JSONObject> getReportData();

 /*   //发布作品/存入草稿箱
    @POST("works/deal/{action}")
    @FormUrlEncoded
    Observable<JSONObject> sendData(@Path("action") int record_id, @FieldMap Map<String, Object> map);*/

    //发布作品/存入草稿箱
/* //   @Multipart
    @POST("admin_LqI4jb.php/ajax/recordUploadForPhone")
    @FormUrlEncoded
    Observable<JSONObject> sendData(@FieldMap Map<String, Object> map);*/
    //Observable<BaseResultEntity<UploadResulte>> uploadImage(@Part("uid") RequestBody uid, @Part("auth_key") RequestBody auth_key,@Part MultipartBody.Part file);
  /*  @Multipart
    @POST("admin_LqI4jb.php/ajax/recordUploadForPhone")
    Observable<JSONObject> sendData(@Part("score") int score, @Part("material_id") int material_id,
                                    @Part("is_released") int is_released, @Part("bgm_id") int bgm_id, @Part MultipartBody.Part file);*/
    @Multipart
    @POST("admin_LqI4jb.php/ajax/recordUploadForPhone")
    Observable<JSONObject> sendData(@Part("user_id") int user_id,@Part("score") int score,@Part("emotion_score") int emotion_score,@Part("integrity_score") int integrity_score, @Part("phone_score") int phone_score, @Part("tone_score") int tone_score,
                                    @Part("fluency_score") int fluency_score, @Part("accuracy_score") int accuracy_score,@Part("material_id") int material_id,
                                    @Part("is_released") int is_released, @Part("bgm_id") int bgm_id, @Part MultipartBody.Part file);




    /* @Multipart
     @POST("admin_LqI4jb.php/ajax/recordUploadForPhone")
     Observable<JSONObject> sendNoBgmData(@Part("score") int score, @Part("material_id") int material_id,
                                         @Part("is_released") int is_released, @Part MultipartBody.Part file);
   admin_LqI4jb.php/ajax/recordUpload
 */
    // @POST("works/upload")
    @Multipart
    @POST("admin_LqI4jb.php/ajax/recordUploadForPhone")
    Observable<JSONObject> sendNoBgmData(@Part("user_id") int user_id,@Part("score") int score,@Part("emotion_score") int emotion_score,@Part("integrity_score") int integrity_score, @Part("phone_score") int phone_score, @Part("tone_score") int tone_score,
                                         @Part("fluency_score") int fluency_score ,@Part("accuracy_score") int accuracy_score, @Part("material_id") int material_id,
                                         @Part("is_released") int is_released, @Part MultipartBody.Part file);

    //草稿箱发布作品接口
    @PUT("user/draft/{record_id}")
    Observable<JSONObject> setIssue(@Path("record_id") int record_id);

    //个人中心-点赞数
    @GET("user/likes_count")
    Observable<JSONObject> getLikes();

    //个人中心-作品数
    @GET("user/works_count")
    Observable<JSONObject> getWorks();

    //点击、朗读次数统计
    @PUT("materials/count/{cate}/{material_id}")
    Observable<JSONObject> clickNum(@Path("cate") int cate, @Path("material_id") int material_id);

    //忘记密码
    @POST("user/pwd/{uid}")
    @FormUrlEncoded
    Observable<JSONObject> forgotPassword(@FieldMap Map<String, Object> map, @Path("uid") int uid);

    //修改密码
    @PUT("user/pwd")
    @FormUrlEncoded
    Observable<JSONObject> changePassword(@FieldMap Map<String, Object> map);

    //修改个人信息
    @PUT("user/profile")
    @FormUrlEncoded
    Observable<JSONObject> updataPersonInfo(@FieldMap Map<String, Object> map);

    //密保问题验证
    @POST("secret_guard/verify")
    @FormUrlEncoded
    Observable<JSONObject> verify(@FieldMap Map<String, Object> map);

    //党员信息页面
    @GET("user/info")
    Observable<JSONObject> getPartyMemberInfo();

    //个人头像列表
    @GET("user/avatar_list")
    Observable<JSONObject> getAvatarList();

    //班级一级列表
    @GET("user/classInfo")
    Observable<JSONObject> getClassInfo();

    //班级二级列表
    @GET("user/list/{id}")
    Observable<JSONObject> getClasslistInfo(@Path("id") String id);

    //登陆
    @POST("sLogin/{id}")
    Observable<JSONObject> getsLogin(@Path("id") String id);


}
